from datetime import datetime

from enum import Enum, unique


class Model(object):
    def __init__(self, create_time=datetime.utcnow(), sort_index=0) -> None:
        self.sort_index = sort_index
        self.create_time = create_time


class Tag(Model):  # 标签
    def __init__(self, key, value) -> None:
        self.key = key
        self.value = value
        super().__init__()


class Phase(Model):  # 阶段
    def __init__(self, title, sort_index) -> None:
        self.title = title
        self.sort_index = sort_index
        super().__init__()


class Case(Model):  # 案件信息
    def __init__(self, phase_id, title, desc, tags=[]) -> None:
        self.phase_id = phase_id
        self.title = title
        self.desc = desc
        self.tags = tags
        self.actdate = ""     # 事故日期
        self.courtdate = ""   # 开庭日期

        super().__init__()


class Comment(Model):  # 评论
    def __init__(self, case_id, content) -> None:
        self.case_id = case_id
        self.content = content
        super().__init__()


class Task(Model):  # 任务
    def __init__(self, case_id, title, expired_time, is_finished=False) -> None:
        self.case_id = case_id
        self.title = title
        self.expired_time = expired_time
        self.is_finished = is_finished
        super().__init__()


class AdditionalFile(object):  # 文件附件
    pass

# 责任划分比例


class CompRate(Enum):
    All = 0             # 全责
    Secendary = 1       # 次要责任
    Same = 2            # 同等责任
    Main = 3            # 主要责任
    No = 4              # 无责任
